home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / infosrvr / dev / www_talk.930 / 000530_fine@cis.ohio-state.edu _Fri Jan 8 21:23:57 1993.msg < prev    next >
Internet Message Format  |  1994-01-24  |  4KB

  1. Return-Path: <fine@cis.ohio-state.edu>
  2. Received: from dxmint.cern.ch by  nxoc01.cern.ch  (NeXT-1.0 (From Sendmail 5.52)/NeXT-2.0)
  3.     id AA02265; Fri, 8 Jan 93 21:23:57 MET
  4. Received: by dxmint.cern.ch (5.65/DEC-Ultrix/4.3)
  5.     id AA03129; Fri, 8 Jan 1993 21:38:55 +0100
  6. Received: by soccer.cis.ohio-state.edu (5.61-kk/5.911008)
  7.     id AA14229; Fri, 8 Jan 93 15:38:20 -0500
  8. Date: Fri, 8 Jan 93 15:38:20 -0500
  9. From: Thomas A. Fine <fine@cis.ohio-state.edu>
  10. Message-Id: <9301082038.AA14229@soccer.cis.ohio-state.edu>
  11. To: connolly@pixel.convex.com, @cis.ohio-state.edu@cis.ohio-state.edu
  12. Subject: Re: dealing with new-lines 
  13. Cc: www-talk@nxoc01.cern.ch
  14. X-Mailer: Perl Mail System v1.1
  15.  
  16.  
  17. >Darn good question. Your approach appears to have the correct
  18. >results, but I'm not sure it's practical for many implementations
  19. >(global search-and-replace operations are inconvenient for
  20. >sequential processing models), and it certainly isn't a healthy
  21. >way to think about SGML documents.
  22.  
  23. But most browsers seem to have cacheing anyway, which means they can do
  24. global search/replace.  But you can still do it more or less sequentially.
  25. Just buffer strings of new-lines until you know what follows them, and
  26. then deal with it.  There's no method you can propose which is correct
  27. and doesn't involve storing something somewhere.
  28.  
  29. >The way to think about SGML documents, IMHO, is this: the sequence
  30. >of characters comprising an SGML document are presented to an
  31. >SGML parser, which parses the markup from the data and passes
  32. >the "results" to the processing application.
  33.  
  34. This is another alternative I considered.  But I figured that I have to
  35. deal with various parsing things when I read the HTML anyway.  I was
  36. just going to take each chunk of data, (with anchors pre-processed out)
  37. and remove all whitespace at the beginning and end (except for PRE sections
  38. and such).  But if someone put in whitespace, why should I muck with it?
  39. Who knows, they might have even wanted it there.
  40.  
  41. >>1. For each tag NOT in
  42. >>     <PRE> </PRE> <A> </A> <PLAINTEXT>
  43. >>   remove ALL surrounding new-lines.
  44. >
  45. >First, let's get one thing straight: the PLAINTEXT element as
  46. >described by the original HTML documentation is not representable
  47. >in SGML. For my purposes, I consider the HTML document to
  48. >end at the <PLAINTEXT> tag, and I consider the rest of the
  49. >data stream to be an RFC-822 message body or a MIME text/plain body,
  50. >and not SGML at all.
  51.  
  52. I hadn't meant otherwise.  But you have to read it in anyway, and since
  53. my method deals with things prior to any other parsing, you treat it
  54. all as one clump.
  55.  
  56. >Next, let's keep in mind that you can't do things like the following
  57. >global substitition,
  58. >s/\n+(<(H1|H2|ADDRESS...))>/$2/g;
  59. >because it might find things that look like tags but aren't,
  60. >for example
  61. >
  62. ><foo bar="
  63. ><H1>this is a little cooky, but nontheless legal and possible.">
  64. >
  65. >But even if you're using a proper SGML parser, consider:
  66. >
  67. ><H1>Here we go!
  68. ><a href="#xyz">click here</a>
  69. >There we went!
  70. ></H1>
  71. >
  72. >The parser will return an H1 start tag, and then the
  73. >string "Here we go!\n". At this point, your rule doesn't
  74. >tell me what to do with the newline. I have to get
  75. >the next object before I decide.
  76.  
  77. Like I said before, You have to do some sort of storage at some point
  78. anyway.
  79.  
  80. >Hmm... I guess that's reasonable. But I'd rather just pass all the
  81.  
  82. Like I said before, You have to do some sort of storage at some point
  83. anyway.
  84.  
  85. >My point is: don't use whitespace to represent significant
  86. >information except in the PRE elemnt. Use the tags that
  87. >are defined to have significance.
  88.  
  89. I suppose I agree with this more or less, at least from the point of view
  90. of generating my own code.  But we have to make something clear - can
  91. a browser keep all the whitespace if it wants to?  Or in other words,
  92. can an html generator assume collapsing whitespace, or just be aware
  93. that it might happen?
  94.  
  95.      tom